package com.frontcamera;

import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import static com.frontcamera.MainActivity.preferences;

public class RegisterDoorButtonListener   extends AppCompatActivity implements Button.OnClickListener {
    private static RegisterDoorButtonListener _instance;
    String id = preferences.getString("id", null);
// 通过 surfaceViewCallBack 来获取最近的图像帧
    private SurfaceViewCallback surfaceViewCallBack;
    private RegisterDoorButtonListener(){
        super();
    }

    public static RegisterDoorButtonListener getInstance(){
        if (_instance == null)
            _instance = new RegisterDoorButtonListener();

        return _instance;
    }

    public void rigsterSurfaceViewCallback(SurfaceViewCallback callback){
        surfaceViewCallBack = callback;
    }
    @Override
    public void onClick(View v){
        Toast toast = Toast.makeText(v.getContext(),"注册中……",Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER, 0, 0);
        toast.show();

//          Intent intent1=getIntent();
//
//        String user=intent1.getStringExtra("u");

//
//        AlertDialog.Builder dialog=new AlertDialog.Builder(this);
//        View view1 = View.inflate(this, R.layout.activity_alter_dialog_setview, null);
//        final EditText et = (EditText) view1.findViewById(R.id.ed);
//        Button bu = (Button) view1.findViewById(R.id.btn);
//        dialog
//                .setTitle("Login")
//                .setIcon(R.mipmap.ic_launcher)
//                .setView(view1)
//                .create();
//        final AlertDialog show = dialog.show();
//        bu.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                Toast.makeText(RegisterDoorButtonListener.this, "电话" + et.getText().toString(), Toast.LENGTH_SHORT).show();
//                show.dismiss();
//            }
//        });



      //  ApiFaceSample.getInstance().register(SurfaceViewCallback.getInstacne().mCurrentFrame64,"anon");
        ApiFaceSample.getInstance().register(SurfaceViewCallback.getInstacne().mCurrentFrame64,MainActivity.et);
     //   Log.e("x","x"+MainActivity.et);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
    }





}
